package com.itheima.admin.controller;

import com.itheima.admin.Service.AdSensitivesService;
import com.itheima.apis.admin.AdsenstivesControllerApi;
import com.itheima.model.common.admin.dtos.SensitivesDto;
import com.itheima.model.common.admin.pojos.AdSensitives;
import com.itheima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/sensitives")
public class AdSensitivesController implements AdsenstivesControllerApi {
    @Autowired
    private AdSensitivesService adSensitivesService;
    @PostMapping("/list")
    @Override
    public ResponseResult findbyNameAndPage(@RequestBody SensitivesDto sensitivesDto) {

        return adSensitivesService.findbyNameAndPage(sensitivesDto);
    }
    @PostMapping("/save")
    @Override
    public ResponseResult insert(@RequestBody AdSensitives adSensitives) {

        return adSensitivesService.insert(adSensitives);
    }
    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitives adSensitives) {
        return adSensitivesService.update(adSensitives);
    }
    @DeleteMapping("/del/{id}}")
    @Override
    public ResponseResult deleteById(@PathVariable("id") Integer id) {
        return adSensitivesService.deleteById(id);
    }
}
